<?php
$sec_id = $_GET['m'];
$sql = "select * from tb_sec WHERE sec_id='{$sec_id}'";
$result = $dbfunc->query($sql);
$fetch = mysql_fetch_array($result);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>เพิ่มข้อมูลอาจารย์</title>

<style type="text/css">
.body {
}
#boxuser{
	background-color: #444041;
	height: auto;
	width: 760px;
}
body,td,th {
	color: #FFF;
}
</style>
</head>

<body>
<div id="boxuser">
<form action="?module=admin&page=update_sec" method="post" enctype="multipart/form-data" name="frm_sec" id="frm_sec">
    <input type="hidden" name="old_id" value="<?php echo $fetch['sec_id']; ?>" />
  <table width="760" border="0" align="center" cellpadding="0" cellspacing="0" id="show_menu">
    
    <tr>
      <th height="35" colspan="3" align="center" bgcolor="#999999">แก้ไขชั้นเรียน</th>
    </tr>
    
    <tr>
      <td width="359" height="35" align="right" bgcolor="#999999"><table width="50%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <th width="6%" height="33" scope="col">&nbsp;</th>
          <td width="94%" align="left" scope="col"><span class="style_1">รหัสชั้นเรียน</span></td>
        </tr>
      </table></td>
      <td width="10" height="35" bgcolor="#999999">:</td>
      <td width="390" height="35" bgcolor="#999999"><span class="style_1">
        <input type="text" name="sec_id" value="<?php echo $fetch['sec_id']; ?>" />
      </span></td>
    </tr>
    <tr>
      <td width="359" height="35" align="right" bgcolor="#999999"><table width="50%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <th width="6%" height="33" scope="col">&nbsp;</th>
          <td width="94%" align="left" scope="col"><span class="style_1">วิชา</span></td>
        </tr>
      </table></td>
      <td width="10" height="35" bgcolor="#999999">:</td>
      <td width="390" height="35" bgcolor="#999999"><span class="style_1">
        <select name="subject_id">
            <?php
            $sql = "select * from tb_subject";
            $result = $dbfunc->query($sql);
            while($item = mysql_fetch_array($result)){
            ?>
            <option value="<?php echo $item['subject_id'];?>" <?php if($item['subject_id']==$fetch['subject_id'])echo 'selected'; ?>><?php echo $item['subject_name'];?></option>
            <? } ?>
        </select>
      </span></td>
    </tr>
    <tr>
      <td height="35" align="right" bgcolor="#999999"><table width="50%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <th width="6%" height="31" scope="col">&nbsp;</th>
          <td width="94%" align="left" scope="col"><span class="style_1">อาจารย์ผู้สอน</span></td>
        </tr>
      </table></td>
      <td height="35" bgcolor="#999999">:</td>
      <td height="35" bgcolor="#999999"><span class="style_1">
        <select name="teacher_id">
            <?php
            $sql = "select * from tb_teacher";
            $result = $dbfunc->query($sql);
            while($item = mysql_fetch_array($result)){
            ?>
            <option value="<?php echo $item['teacher_id'];?>" <?php if($item['teacher_id']==$fetch['teacher_id'])echo 'selected'; ?>><?php echo $item['teacher_name']." ".$item['teacher_surname'];?></option>
            <? } ?>
        </select>
      </span></td>
    </tr>
    <tr>
      <td height="35" align="right" bgcolor="#999999"><table width="50%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <th width="6%" height="30" scope="col">&nbsp;</th>
          <td width="94%" align="left" scope="col"><span class="style_1">คำอธิบายชั้นเรียน</span></td>
        </tr>
      </table></td>
      <td height="35" bgcolor="#999999">:</td>
      <td height="35" bgcolor="#999999"><a id="frm_detail-botton" style="cursor:pointer;">เพิ่มคำอธิบายชั้นเรียน</a><textarea name="sec_des" id="sec_des" cols="60" rows="30" style="display:none;"><?php echo $fetch['sec_des']; ?></textarea></td>
    </tr>
    <tr>
      <td height="35" bgcolor="#999999">&nbsp;</td>
      <td height="35" bgcolor="#999999">&nbsp;</td>
      <td height="40" bgcolor="#999999"><span class="style_1">
        <input type="submit" name="Submit" id="Submit" value=" บันทึก  " />
      </span></td>
    </tr>
    <tr>
      <td height="36" bgcolor="#999999">&nbsp;</td>
      <td bgcolor="#999999">&nbsp;</td>
      <td bgcolor="#999999">&nbsp;</td>
    </tr>
  </table>
  
  <p>&nbsp;</p>
</form>
</div>
<script>
$(function(){
	$("#frm_detail-botton").one('click',function(event){
		event.preventDefault();
		$(this).slideUp();
		$("textarea[name=sec_des]").slideDown();
		return false;
	});
});
</script>
</body>
</html>